<template>
  <div class="box">
    <el-empty :image-size="200" description="暂无接受参数" v-if="num.length==0"></el-empty>
    <div v-else>路由接受的参数为:{{num}}</div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      num:[]
    }
  },
  watch: {
    $route(to, from) {
      if (this.$route.query.transfer) {
        this.num = this.$route.query.transfer;
      }
    }
  },
  mounted() {
    //直接传参
    // this.num=this.$route.params.num
    //方法传参
    // this.num=this.$route.params.id
    // //name匹配路由传参
    // this.num=this.$route.params.id
    // console.log(this.num);  
    //query传参
    // window.history.pushState({}, '', window.location.href+'?a=123')
    if (this.$route.query.id) this.num = this.$route.query.id;
    
    // let query = this.$router.history.current.query;
    // // console.log(query);
    // let path = this.$router.history.current.path;     
    // //对象的拷贝
    // // console.log(path);
    // let newQuery = JSON.parse(JSON.stringify(query));
    // newQuery.id = '55444';
    // this.$router.push({ path, query: newQuery });
  },
  methods: {
  }
}
</script>
<style scoped lang='scss'>
</style>